package com.daiqee.controller;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.daiqee.controller.support.CommonsController;
import com.daiqee.enums.RequestType;
import com.daiqee.pojo.Proposal;
import com.daiqee.service.impl.ProposalService;

/**
 * 意见反馈
 * 
 * <br/>
 * @since JDK 1.8
 * @version  V2.4
 * @author RichardTang 
 * @date: 2018年6月12日
 * @package com.daiqee.controller
 * @copyright:Copyright (c) 2018, 1245811923@qq.com All Rights Reserved.
 */

@Controller()
@RequestMapping("proposal")
public class ProposalController extends CommonsController<Proposal>{

	@Autowired
	private ProposalService proposalService;
	
	@Override
	public boolean warpperAddMethod(Proposal proposal) throws Exception {
		proposal.setProposalAccessId(getCurrentUser().getUserId());
		proposal.setProposalDate(new Date());
		proposal.setProposalState("等待反馈");
		return proposalService.insert(proposal);
	}
	
	/**
	 * 回复意见
	 */
	@RequestMapping(value = "/reply" ,method=RequestMethod.PUT)
	public Object reply(Proposal proposal){
		isNormalFinish = proposalService.updateById(proposal);
		return restfulResponse.response(isNormalFinish,RequestType.GET);
	}
}
